<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>设置我的密码</title>
  <base href="<%=basePath%>">
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="main/layuiadmin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="main/layuiadmin/style/admin.css" media="all">
  <script type="text/javascript" src="js/jquery.min.js"></script>
  
  <script type="text/javascript">
  $(function(){
		//校验密码修改
				//不能为空校验  两次密码验证
		$("#up").submit(function(){
			if($("#pwd1").val()==""){//校验新密码
				alert("新密码不能为空");
				return false;
			}else if($("#pwd2").val()==""){//校验确认密码
				alert("确认密码不能为空");
				return false;
			}else if($("#pwd1").val()!=$("#pwd2").val()){//校验新密码和确认密码是否一致
				alert("两次密码 不一致");
				return false;
			}else if ("#oldpwd"=="") {
				alert("请输入用户名");
				return false;
			}else{
				return true;
			}
		})
	})

	function alert(){
		alert("密码错误！");
	}
	
</script>
</head>
<body>

  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <div class="layui-col-md12">
        <div class="layui-card">
          <div class="layui-card-header">修改密码</div>
          <div class="layui-card-body" pad15>
            <form action="user" method="post" id="up">
            <input type="hidden" name="oper" value="pwd" />
            <div class="layui-form" lay-filter="">
              <div class="layui-form-item">
              	
              	<!-- 使用jstl和EL表达式完成提示语 -->
							<c:choose>
								<c:when test="${flag==0}">
									<div style="text-align: center;">
										<span
											style="font-size: 20px; color: darkerd; font-weight: bold">当前密码错误！</span>
									</div>
								</c:when>
							</c:choose>
							<c:remove var="flag" scope="session" />
              
                <label class="layui-form-label">当前密码</label>
                <div class="layui-input-inline">
                  <input type="password" name="oldpwd" id="oldpwd" class="layui-input">
                </div>
              </div>
              <div class="layui-form-item">
                <label class="layui-form-label">新密码</label>
                <div class="layui-input-inline">
                  <input type="password" name="newpwd" id="pwd1" " autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">6到16个字符</div>
              </div>
              <div class="layui-form-item">
                <label class="layui-form-label">确认新密码</label>
                <div class="layui-input-inline">
                  <input type="password" name="pwd2" id="pwd2"  autocomplete="off" class="layui-input">
                </div>
              </div>
              <div class="layui-form-item">
                <div class="layui-input-block">
                  <input type="submit" name="" class="layui-btn" value="确认修改">
                </div>
              </div>
            </div>
            </form>
          </div>
        </div>
      </div>
    </div>
  </div>

  <script src="main/layuiadmin/layui/layui.js"></script>  
  <script>
  layui.config({
    base: 'main/layuiadmin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'set']);
  </script>
</body>
</html>